package com.jin.stu.controller;

import com.jin.stu.service.LeaveService;
import com.jin.stu.vo.LeaveVo;
import com.jin.sys.common.DataGridView;
import com.jin.sys.common.ResultObj;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/leave")
public class LeaveController {

    @Autowired
    private LeaveService leaveService;


    /**
     * 查询
     */
    @RequestMapping("/loadAllLeave")
    public DataGridView loadAllLeave(LeaveVo leaveVo) {
        return leaveService.loadAllLeave(leaveVo);
    }

    /**
     * 根据假单状态查询
     */
    @RequestMapping("/loadAllLeaveByStatus")
    public DataGridView loadAllLeaveByStatus(LeaveVo leaveVo, Integer status) {
        return leaveService.loadAllLeaveByStatus(leaveVo, status);
    }

    /**
     * 根据假单状态查询已审批的假单
     */
    @RequestMapping("/loadAllLeaveApprovalCheck")
    public DataGridView loadAllLeaveApprovalCheck(LeaveVo leaveVo) {
        return leaveService.loadAllLeaveApprovalCheck(leaveVo);
    }

    /**
     * 添加
     */
    @RequestMapping("/addLeave")
    public ResultObj addLeave(LeaveVo leaveVo) {
        return leaveService.addLeave(leaveVo);
    }

    /**
     * 更新
     */
    @RequestMapping("/updateLeave")
    public ResultObj updateLeave(LeaveVo leaveVo) {
        return leaveService.updateLeave(leaveVo);
    }

    /**
     * 删除
     */
    @RequestMapping("/deleteLeave")
    public ResultObj deleteLeave(Integer id) {
        return leaveService.deleteLeave(id);
    }

    /**
     * 批量删除
     */
    @RequestMapping("batchDeleteLeave")
    public ResultObj batchDeleteLeave(LeaveVo leaveVo) {
        return leaveService.batchDeleteLeave(leaveVo);
    }

    /**
     * 同意
     */
    @RequestMapping("/agreeLeave")
    public ResultObj agreeLeave(Integer id) {
        return leaveService.agreeLeave(id);
    }

    /**
     * 同意
     */
    @RequestMapping("/backoutLeave")
    public ResultObj backoutLeave(Integer id) {
        return leaveService.backoutLeave(id);
    }


}
